Integration Guide FANUC LS

Note: Read the Robot communication overview before you read this integration guide.

Note 2: This page describes the Robot module LS 1.5.0 for FANUC robots and Locator Studio (LS). We strongly recommend that you use the integration guide that comes with the latest version of the Robot module. You can download the Robot module from the official Photoneo website.

Contents

1 Prerequisites

Before the setup, make sure that your robot controller meets these requirements:

  • System version: FANUC controller with software V8.30 - V9.40 (the module contains KAREL binaries for v8 and v9).

    To check the system version, go to Menu -> Next -> Status -> Version ID.

    Older versions (V6.40 - V8.20) need a custom build of the KAREL binary and changes in the TP programs. For these versions, contact Photoneo support.

  • Option R648 User Socket Msg - socket communication with the vision controller.

  • Option R632 KAREL - needed to run the compiled KAREL program PHOCLIENT.

    To check that the options are installed on your robot controller, go to Menu -> Next -> Status -> Version ID -> Next -> F3[ORDER FI]

    Ordered options list with R648 User Socket Msg
  • Locator Studio 1.5 or newer.

2 Robot controller setup

2.1 Controller configuration

2.1.1 Setting the IP addresses of the Ethernet ports

First, configure the IP address of the robot controller port that is connected to the vision controller.

On the teach pendant, press Menu -> Setup -> Host Comm -> TCP/IP -> F3[Detail]:

SETUP Protocols screen with TCP/IP selected

Two Ethernet ports are available. Configure the port that is physically connected to the vision controller (directly or through a switch). In this example, it is Port#1.

Change the IP address of the port to match your network configuration. The robot and the vision controller must be in the same subnet (for example, vision controller 192.168.1.1/24 and robot 192.168.1.2/24):

Port#1 IP address on the TCP/IP screen

Press F3[PORT] to switch between Port#1 and Port#2. If you use ROBOGUIDE for workcell commissioning, you can use the other port to transfer files between the robot controller and your PC:

Port#2 IP address on the TCP/IP screen

To check the connection, use the Ping function on the same screen. Enter the IP address of the vision controller into Remote name/IP and press F4[PING]. You can also use Test connection on the Network page of the vision controller.

2.1.2 Configuring the TCP/IP client

LS is the server, and the robot controller is the client. The robot connects to the vision controller on port 11003 through Host Comm client tag C3.

Press Menu -> Setup -> Host Comm -> F4[SHOW] and select Clients

SHOW menu with the Clients item

Select the C3 slot. The C1 and C2 slots stay free for user applications.

SETUP Clients screen with tag C3 selected

Configure the client C3 as follows:

  • Comment: PHOCLIENT

  • Protocol: SM

  • Startup State: START

  • Server IP/Hostname: IP address of the vision controller

Client tag C3 settings

Do not set the port on this screen. PHOCLIENT writes 11003 to the system variable $HOSTC_CFG[3].$SERVER_PORT every time it starts. If this fails, PHOCLIENT stops with the message Wrong $HOSTC_CFG[3].$SERVER_PORT. In that case, set the variable to 11003 manually.

Cycle the power of the robot controller to apply the new settings. After the restart, the Current State of client C3 should be STARTED.

2.2 Robot module installation

2.2.1 Loading the Robot module files

The Robot module consists of one KAREL program (PHOCLIENT) and a set of TP programs. The archive Photoneo_LS_Module_1_5_0.zip contains:

Folder / file

Content

Karel/v8/phoclient.pc

Compiled KAREL program for controllers with software V8.x.

Karel/v9/phoclient.pc

Compiled KAREL program for controllers with software V9.x.

TP/*.TP

All TP programs (request programs and example programs) in binary format. Load these files.

LS/*.LS

The same TP programs as text, for reading and comparing only.

README.md, CHANGELOG.md, PDF guide and cheatsheet

Documentation.

Load only one phoclient.pc (the one that matches your software version) and all files from the TP folder. Do not load the .kl source file (it is not part of the archive). The load order does not matter.

Copy the Karel and TP folders to a USB stick and plug it into the teach pendant (UT1:) or into the USB port of the controller cabinet (UD1:).

Press Menu -> File -> File -> F5[UTIL] and select Set Device:

FILE screen with UTIL menu and Set Device

Select the device where the USB stick is plugged in, for example USB on TP (UT1:):

Device menu with USB on TP (UT1:)

Press F2[DIR] and select *.*(all files) to show all items on the USB stick.

FILE screen showing the module folder on the USB stick

Open the Karel folder and then the v8 or v9 folder. Select PHOCLIENT.PC and press F3[LOAD]. When the file is loaded, the message Loaded UT1:\KAREL\V9\PHOCLIENT.PC is shown:

PHOCLIENT.PC loaded from the USB stick

Open the TP folder, select the item TP (ALL TP PROGRAMS) and press F3[LOAD] to load all TP programs at once:

Loading all TP programs at once

Press the Select button and check that PHOCLIENT and all PHO_* TP programs are listed.

2.3 UTOOL and UFRAME setup

LS calculates all results in the FANUC World frame. For this to work, the robot must report the pose of the bare flange in the World frame every time it sends its current pose to the vision controller. These requests send the current pose:

  • the hand-eye Scan request (R[8] = 1),

  • the Capture scan request (meshing),

  • the Add calibration point request.

PHOCLIENT takes the frames for this pose from two registers:

  • R[9: PHO UTOOL ID] - tool frame number, valid range 1 - 10

  • R[10: PHO UFRAME ID] - user frame number, valid range 1 - 9

Set both registers to frames with all values zero. If a number is out of range, the request is rejected with Bad data (4) in R[4].

Set up the frames in Menu -> Setup -> Frames. Use F3[OTHER] to switch between Tool Frame and User Frame. Example of a zeroed user frame 1:

User frame 1 with all values zero

Example of a zeroed tool frame:

Tool frame with all values zero

The example programs use tool frame 1 for the real gripper (EOAT), tool frame 2 for the zeroed tool and user frame 2 for the calibration frame. So they set UTOOL_NUM=1 and UFRAME_NUM=2 for picking, and R[9] = 2 and R[10] = 2 for scanning. Change the numbers to match your frame setup:

 3:  !Set UTOOL and UFRAME IDs ;
 4:  !for Picking Operations ;
 5:  !UTOOL-use real TCP ;
 6:  !UFRAME-same as calibration ;
 7:  UTOOL_NUM=1 ;
 8:  UFRAME_NUM=2 ;
 9:  !Set UTOOL and UFRAME IDs ;
10:  !for Scanning Operations ;
11:  !UTOOL R[9]-use zeroed TCP ;
12:  !UFRAME R[10]-same as calibration ;
13:  R[9:PHO UTOOL ID]=2    ;
14:  R[10:PHO UFRAME ID]=2    ;

Change the frame numbers to match your own frame setup.

3 Robot module

You can easily integrate the Robot module into your existing TP programs. The KAREL program PHOCLIENT runs as a background task. It holds the connection to the vision controller and does all the communication. TP programs communicate with PHOCLIENT through registers and flags. A request TP program writes the request ID to R[1], sets F[2: NEW REQUEST] and waits for F[3: RES RECEIVED].

The LS Robot module for FANUC has no Robot State Server.

3.1 Robotic API

Note: Read Action requests before you read this section.

This section describes the TP programs that come with the Robot module. Use these procedures for high-level control of the LS application.

3.1.1 Connection procedures

Command

Description / Usage

Clear module flags and registers

CALL PHO_CLEAR_VARS
Description
Resets F[1] - F[3] and R[1], R[4], R[6].

Usage
Call it once at the beginning of the program, before RUN PHOCLIENT.
Connect to Action Request Server

RUN PHOCLIENT
Description
Starts the background KAREL task. The task sets the server port, adds comments to the registers that the module uses and clears SR[1] - SR[25]. Then it connects to the vision controller through client tag C3 and sends the brand ID.

Usage
Run it once at the beginning of the program. Run it again after an error has ended the session (see Error handling).
Wait for connection to Action Request Server

WAIT (F[1:CONNECTED]=ON)
Description
Waits until the connection to the Action Request Server is established.

Usage
Usually directly after RUN PHOCLIENT.
Disconnect

Fctn -> Abort all
Description
Aborts the TP program and PHOCLIENT. The connection is closed.

3.1.2 Communication procedures

Note: For a detailed description of these requests, see Action requests.

Inputs - registers that you must set before you call the request.
Outputs - registers that the request sets.
Every request writes the error code to R[4: PHO ERROR_DATA] (0 = success). Register names are shown as the comments that PHOCLIENT writes to the registers.

TP program

ID

Inputs

Outputs

PHO_REQ_SCAN

19

R[2] vision system ID
R[8] hand-eye: 0 = off, 1 = on (sends current pose)
R[9], R[10] frames for the pose (if R[8] = 1)
Returns directly after the request is sent.
PHO_WAIT_SCAN receives the response.
PHO_WAIT_SCAN

-

-

R[4]
Waits for the response of PHO_REQ_SCAN or PHO_REQ_CAPTURE.
PHO_REQ_GET_POSES

20

R[2] vision system ID
R[5] number of requested objects, 1 - 97 (0 or less is sent as 1, more than 97 is sent as 97)
PR[1] … PR[n] object poses
R[6] number of received objects (n)
R[14] first PR (always 1), R[15] last PR (n)
R[24] - R[29] and SR[1] - SR[25] Info data

22

R[2] vision system ID

R[16] number of localized objects
R[17] number of objects ready to be sent
R[18] 1 = localization running, 0 = finished
PHO_REQ_CAPTURE

30

R[2] vision system ID
R[9], R[10] frames for the pose (always sent)
F[4] dynamic meshing on/off
R[13] delay between scans in ms (dynamic meshing)
Captures a scan for meshing. Does not start the localization.
PHO_WAIT_SCAN receives the response.
F[5] is set after the first scan (dynamic meshing).

31

R[2] vision system ID

R[4]

PHO_CHANGE_BBOX

33

R[2] vision system ID
R[20] bounding box ID

R[4]

5

R[9], R[10] frames for the pose (always sent)

R[4]

25

R[3] solution ID
R[2] vision system ID

R[4]

26

-

R[4]

27

-

R[19] calibration accuracy (mm)
PR[99] calibration result pose
PHO_CHANGE_SOL

9

R[3] solution ID

R[4]

PHO_REQ_START_SOL

10

R[3] solution ID

R[4]

PHO_REQ_STOP_SOL

11

-

R[4]

12

-

R[3] running solution ID

PHO_REQ_COM_CHECK

100

-

R[4]

Pose handling

  • Object poses are written to PR[1] - PR[n] as Cartesian (XYZWPR) positions in the World frame. The configuration and the extended axes are taken from the current robot position.

  • Loop over the received poses with FOR R[7:PHO LOOP ITER]=R[14:PHO START PR] TO R[15:PHO LAST PR] and move to PR[R[7]].

  • PR[100: PHO APR OFFSET] is the approach offset used by the example programs (Offset,PR[100]). Set it yourself before the first run. A typical value is Z = 100 mm and all other values 0.

Dynamic meshing (Instant Meshing, MotionCam-3D only)

Set F[4: MESH DYNAMIC] = ON and call PHO_REQ_CAPTURE. PHOCLIENT captures scans continuously with a delay of R[13] ms (0 - 10000; other values use 500 ms). It sets F[5: MESH STARTED] after the first scan. Wait for F[5] before you start moving, and move through the waypoints. Then set F[4] = OFF, reset F[5] and call PHO_WAIT_SCAN. Finally, call PHO_REQ_SCAN + PHO_WAIT_SCAN to start the localization on the merged scan. See PHO_MAIN_LOC_MULTIVIEW_DYNAMIC.

For static meshing, keep F[4] = OFF and call PHO_REQ_CAPTURE + PHO_WAIT_SCAN in every scanning pose. See PHO_MAIN_LOC_MULTIVIEW_STATIC.

3.1.3 List of used registers

The Robot module uses the flags, registers and position registers listed below. Do not use them for other purposes. PHOCLIENT writes the comments shown in the tables every time it starts.

Flags

Flag

Set by

Description

F[1: CONNECTED]

PHOCLIENT

ON while the connection to the vision controller is open.

F[2: NEW REQUEST]

request TP

Set by a request TP program, reset by PHOCLIENT when the request is accepted.

F[3: RES RECEIVED]

PHOCLIENT

Set when the response is received. The request TP program resets it.

F[4: MESH DYNAMIC]

user

ON = dynamic meshing (continuous capturing). Set it before the first PHO_REQ_CAPTURE, and reset it after the last meshing waypoint.

F[5: MESH STARTED]

PHOCLIENT

Set after the first scan of dynamic meshing. The TP program waits for it before it moves, then resets it.

Registers

Register

Set by

Description

R[1: PHO REQ TYPE]

request TP

Request ID of the current request.

R[2: PHO VISION_ID]

user

Vision system ID.

R[3: PHO SOLUTION_ID]

user / module

Solution ID for start / change solution and calibration start. Set to the running solution ID by PHO_REQ_RUN_SOL.

R[4: PHO ERROR_DATA]

module

Error code of the last request, 0 = success. See Error handling.

R[5: PHO NUM_TAR_REQ]

user

Number of requested objects (1 - 97).

R[6: PHO NUM TAR RCV]

module

Number of received objects.

R[7: PHO LOOP ITER]

TP program

Loop counter for the picking loop in the example programs.

R[8: PHO HAND E ENB]

user

Hand-eye scan: 0 = off, 1 = on (the current pose is sent with the scan request).

R[9: PHO UTOOL ID]

user

Tool frame (1 - 10) for the pose sent by hand-eye scan, capture and calibration requests.

R[10: PHO UFRAME ID]

user

User frame (1 - 9) for the pose sent by hand-eye scan, capture and calibration requests.

R[11], R[12]

-

Reserved.

R[13: PHO CAPTURE GAP]

user

Delay between scans in dynamic meshing, in ms (0 - 10000, default 500).

R[14: PHO START PR]

module

Number of the first PR with a received pose (always 1).

R[15: PHO LAST PR]

module

Number of the last PR with a received pose.

R[16: PHO NUM LOCALIZED]

module

Number of localized objects (Get status).

R[17: PHO NUM PLANNED]

module

Number of objects ready to be sent (Get status).

R[18: PHO VS RUNNING]

module

1 = localization running, 0 = finished (Get status).

R[19: PHO CAL ACCURACY]

module

Calibration accuracy in mm (real value), set by PHO_CALIB_SAVE.

R[20: PHO BBOX ID]

user

Bounding box ID for PHO_CHANGE_BBOX.

R[21] - R[23]

-

Reserved.

R[24] - R[29]

module

Info data of the last received object, see Info data.

R[30]

-

Reserved.

Position registers

Position register

Set by

Description

PR[1] - PR[97]

module

Received object poses (PHO CARTESIAN DATA).

PR[99: PHO RECENT CALIB DATA]

module

Calibration result pose from the last PHO_CALIB_SAVE. Useful for checks, especially in hand-eye applications.

PR[100: PHO APR OFFSET]

user

Approach offset used by the example programs.

String registers

SR[1] - SR[25] (PHO INFO DATA) hold the Info data of the received objects as text (see Info data). They are cleared when PHOCLIENT starts.

To see the registers, press Data and use F1[TYPE] to switch between register types.

3.1.4 Info data

Info data are extra values sent with some responses. PHOCLIENT stores them as follows:

Key

Info data

Register

Unit in robot

Returned by

4

Dimension X

R[24: PHO OBJ DIM X]

mm (integer)

Get objects

5

Dimension Y

R[25: PHO OBJ DIM Y]

mm (integer)

Get objects

6

Rotation Z

R[26: PHO OBJ ROT Z]

deg (real)

Get objects

7

Neural network label

R[27: PHO NN LABEL]

integer

Get objects

8

Max Z height

R[28]

mm (integer)

Get objects

9

Tilt

R[29]

deg (real)

Get objects

10

Calibration accuracy

R[19: PHO CAL ACCURACY]

mm (real)

Calib save

11

Running solution ID

R[3: PHO SOLUTION_ID]

integer

Get running solution

12

Number of localized objects

R[16: PHO NUM LOCALIZED]

integer

Get status

13

Number of ready objects

R[17: PHO NUM PLANNED]

integer

Get status

14

Processing state

R[18: PHO VS RUNNING]

0 / 1

Get status

Keys 4 - 9 are sent only by solutions that provide them (AI-based localization and delayering). R[24] - R[29] hold the values of the last received object.

The values of each object are also added as text to a string register. The object in PR[1] uses SR[1], the object in PR[2] uses SR[2] and so on, up to SR[25]. Each value takes 5 characters followed by ;, in the order in which the values are received. Rotation and tilt are written in degrees with one decimal place.

3.1.5 Error codes defined by the module

PHOCLIENT defines the following constants. The Error codes page describes their meaning.

Constant

Code

Meaning

OK

0

No error

UNKNOWN_REQ

2

Unknown request ID in R[1]

COMM_FAILURE

3

Communication error

BAD_DATA

4

Bad data (for example, the frame number in R[9] / R[10] is out of range)

INVALID_SOL … SOL_FORBID

450 - 459

Solution errors (450 invalid solution, 451 another solution running, 452 start failed, 453 not running, 454 stop failed, 455 incomplete, 457 invalid brand ID, 458 already running, 459 not allowed)

INVALID_VS … CALIB_FORBID

460 - 469

Calibration errors (460 invalid vision system, 461 calibration running, 462 calibration not running, 463 stop failed, 464 start failed, 465 automatic calibration disabled, 466 not enough points, 467 accuracy above threshold, 468 scanner not available, 469 not allowed)

VS_NOT_FOUND … REJECT_STOP

500 - 505

Locator errors (500 vision system not found, 501 empty scene, 502 no object yet / running, 503 no object / finished, 504 all rejected / running, 505 all rejected / finished)

3.2 Example programs

The module contains the following example TP programs. They show the correct use of the request programs and basic error handling.

Program

Purpose

PHO_MAIN_LOC_BASIC

Basic picking with a statically mounted scanner: scan, get poses, pick all received objects, repeat.

PHO_MAIN_LOC_GET_STATUS

Like the basic example, but calls PHO_REQ_GET_STATUS several times between the scan and the get poses request to monitor the localization progress.

PHO_MAIN_LOC_HAND_EYE

Picking with a robot-mounted (hand-eye) scanner: R[8] = 1 and R[9] / R[10] are set, so the pose is sent with every scan.

PHO_MAIN_LOC_MULTI_VS

Switches between vision system 1 and 2 (R[2]) after each picking cycle.

PHO_MAIN_LOC_BBOX_SWITCH

Switches between bounding box 1 and 2 (R[20]) with PHO_CHANGE_BBOX after each picking cycle.

PHO_MAIN_LOC_SOL_SWITCH

Gets the running solution, stops it, starts solution 201 and then alternates between solutions 201 and 202 with PHO_CHANGE_SOL.

PHO_MAIN_LOC_REUSE_SCAN

Scans with vision system 1, picks, then localizes again on the same scan with vision system 2 (PHO_REQ_REUSE_SCAN).

PHO_MAIN_LOC_MULTIVIEW_STATIC

Static meshing: the robot stops in 5 poses, captures a scan in each (PHO_REQ_CAPTURE + PHO_WAIT_SCAN) and then starts the localization with PHO_REQ_SCAN. Use fewer than 10 scans.

PHO_MAIN_LOC_MULTIVIEW_DYNAMIC

Dynamic meshing (MotionCam-3D only): scans are captured while the robot moves (F[4], F[5], R[13]). Use a smooth path, keep the scene in view and use fewer than 50 scans.

PHO_MAIN_COMM_CHECK

Like the basic example, with PHO_REQ_COM_CHECK before the scan and before the get poses request. Ends the program if the check fails.

PHO_CALIBRATION

Calibration template: start calibration, add 9 points, save and stop. See Calibration example.

3.2.1 Main program example

This program is a basic example of a locator application that picks objects with a statically mounted scanner.
It connects to the vision controller. Then, in a loop, it:
  • moves to a scanning pose and requests a scan,

  • requests object poses (3 in this example),

  • if no error occurred, picks all received objects:

    • goes to a start pose and then to an approach pose above the object (PR[100] offset),

    • moves linearly to the object and picks it (you must add the gripper command),

    • moves linearly back to the approach pose and out of the scanning volume,

    • executes the placing procedure (you must add it),

  • requests the next scan when all objects are picked.

If no object is found yet (502, 504), it asks for the poses again. If the scene is empty or the localization has finished without a result (501, 503, 505), it scans again. Any other error aborts the program.

Name: PHO_MAIN_LOC_BASIC

 1:  !INITIALIZATION ;
 2:  CALL PHO_CLEAR_VARS    ;
 3:  !Set UTOOL and UFRAME IDs ;
 4:  !for Picking Operations ;
 5:  !UTOOL-use real TCP ;
 6:  !UFRAME-same as calibration ;
 7:  UTOOL_NUM=1 ;
 8:  UFRAME_NUM=2 ;
 9:  !Turn Hand Eye Mode OFF ;
10:  R[8:PHO HAND E ENB]=0    ;
11:  !Set Number of Requested Targets ;
12:  R[5:PHO NUM_TAR_REQ]=3    ;
13:  !Start Phoclient ;
14:  RUN PHOCLIENT ;
15:  !Wait For Establishing Connection ;
16:  WAIT (F[1:CONNECTED]=ON)    ;
17:   ;
18:  !============================= ;
19:  !MAIN LOOP ;
20:  !============================= ;
21:  !SCAN REQUEST ;
22:  LBL[1] ;
23:  !Move To Scanning Position ;
24:J P[1] 10% FINE    ;
25:  !Set Vision System ID ;
26:  R[2:PHO VISION_ID]=1    ;
27:  !Send Scan Request ;
28:  CALL PHO_REQ_SCAN    ;
29:  !Wait For Scan ;
30:  CALL PHO_WAIT_SCAN    ;
31:  !If OK then Continue to Get Poses ;
32:  IF R[4:PHO ERROR_DATA]=0,JMP LBL[2] ;
33:  !If Comm or Other Error Abort ;
34:  ABORT ;
35:   ;
36:  !GET POSES REQUEST ;
37:  LBL[2] ;
38:  !Send Get Poses Request ;
39:  CALL PHO_REQ_GET_POSES    ;
40:  !If OK, then proceed to picking ;
41:  IF R[4:PHO ERROR_DATA]=0,JMP LBL[3] ;
42:  !If Empty Scene, Rescan ;
43:  IF R[4:PHO ERROR_DATA]=501,JMP LBL[1] ;
44:  !If No Object Found yet, Rescan ;
45:  IF R[4:PHO ERROR_DATA]=502,JMP LBL[2] ;
46:  !If No Object Found Then Rescan ;
47:  IF R[4:PHO ERROR_DATA]=503,JMP LBL[1] ;
48:  !If objects rejected yet, Rescan ;
49:  IF R[4:PHO ERROR_DATA]=504,JMP LBL[2] ;
50:  !If all object rejected, Rescan ;
51:  IF R[4:PHO ERROR_DATA]=505,JMP LBL[1] ;
52:  !If Comm or Other Error, Abort ;
53:  ABORT ;
54:   ;
55:  !MANIPULATION ;
56:  LBL[3] ;
57:  !Loop Setup ;
58:  FOR R[7:PHO LOOP ITER]=R[14:PHO START PR] TO R[15:PHO LAST PR] ;
59:  !Move to Start Position ;
60:J P[2] 10% FINE    ;
61:  !Approach Pose ;
62:J PR[R[7]] 25% CNT100 Offset,PR[100:PHO APR OFFSET]    ;
63:  !Grasp Pose ;
64:L PR[R[7]] 1000mm/sec FINE    ;
65:  !Insert your Gripper Command ;
66:  !CALL MY_GRIPPER_CMD ;
67:  !Deaproach Pose ;
68:L PR[R[7]] 1000mm/sec CNT100 Offset,PR[100:PHO APR OFFSET]    ;
69:  !Move Out Of Scanning Vol ;
70:J P[3] 100% FINE    ;
71:  !Placing ;
72:  !CALL YOUR PLACING ROUTINE ;
73:  ENDFOR ;
74:   ;
75:  !Jump Back to Main Loop ;
76:  JMP LBL[1] ;

3.2.2 Calibration example

PHO_CALIBRATION is a template for calibration with 9 calibration poses. It works as follows:

  1. Call PHO_CLEAR_VARS, RUN PHOCLIENT and wait for F[1].

  2. Set R[9] / R[10] to the zeroed tool and user frame (see UTOOL and UFRAME setup), R[3] to the solution ID and R[2] to the vision system ID.

  3. Start - PHO_CALIB_START (lines 21 - 28). If R[4] is not 0, the program aborts.

  4. Add points - the robot moves to the start pose and then to calibration poses 1 - 9. In each pose, it waits 1 s and calls PHO_CALIB_ADD. If a point fails, the program shows a message, R[4] holds the error code, and the program continues with the next pose.

  5. Save - after the end pose, PHO_CALIB_SAVE (lines 126 - 131) saves the result. The accuracy is written to R[19] (mm) and the result pose to PR[99].

  6. Stop - PHO_CALIB_STOP ends the calibration.

Before you run the program, teach the start pose, the 9 calibration poses and the end pose.

First calibration: Start the calibration manually in LS. Comment out lines 21 - 28 (start) and 126 - 131 (save). The robot then only adds the points. Check and save the result in LS. As a general rule, the calibration error should be below 3 mm. A higher value usually means a systematic error (wrong frames in R[9] / R[10]).

Automatic recalibration: After the first calibration is successful and automatic recalibration is enabled in the vision system settings, enable lines 21 - 28 and 126 - 131 again. The calibration object must stay where it was during the first calibration. The calibration ball stays mounted in the same place on the flange or gripper and moves with the robot. The marker pattern stays in the same place in the cell. If the accuracy is above the threshold set in LS, PHO_CALIB_SAVE returns 467 and the session ends.

3.3 Error handling

If an error occurs, the error code is stored in R[4: PHO ERROR_DATA] and PHOCLIENT writes a message to the USER screen. Check R[4] after every request and after PHO_WAIT_SCAN. For a description of the error codes, see Error codes.

Note: Error Timeout (5) is not used on FANUC.

Depending on the error, PHOCLIENT either keeps the session open or ends it:

Error code

PHOCLIENT

501 - 505, 453, 454, 458, 461, 463, errors of PHO_CALIB_ADD

Keeps the connection and waits for the next request. The TP program can continue (for example, scan again or ask for the poses again).

All other errors - for example 3, 4, 500, 450 - 452, 455, 457, 459, 460, 462, 464 - 469

Closes the connection and stops. F[1: CONNECTED] is reset.

When PHOCLIENT has stopped, the TP program must start it again before it sends the next request:

IF (F[1:CONNECTED]=OFF) THEN ;
RUN PHOCLIENT ;
WAIT (F[1:CONNECTED]=ON)    ;
ENDIF ;

PHOCLIENT also stops when:

  • it cannot connect to the vision controller or a socket error occurs - R[4] = 3,

  • R[1] contains an unknown request ID - R[4] = 2,

  • $HOSTC_CFG[3].$SERVER_PORT cannot be set to 11003 (see Configuring the TCP/IP client).

Use PHO_REQ_COM_CHECK to check that the connection is still working (see PHO_MAIN_COMM_CHECK).

4 Running the Main program example

4.1 Prerequisites

Before you run the Main program example, make sure that:

  • A fully configured solution with a single vision system is ready for deployment.

  • All vision systems of the solution are calibrated.

  • The robot controller is configured according to Robot controller setup and ping works in both directions.

  • The LS network settings are configured.

  • PR[100] (approach offset) is set.

  • The gripper procedures are implemented (optional - without them, the robot does not actually pick the object).

  • The placing procedure is implemented.

4.2 Reteach the robot poses

The Main program example uses the following poses:

  • P[1] Scanning pose - the scan is requested in this pose. For extrinsic vision systems, the robot must not block the view of the scanning area. For hand-eye vision systems, the scanner on the robot must have an optimal view of the scene.

  • P[2] Start pose - a pose from which the robot moves to the approach pose above the object.

  • P[3] Pose outside the scanning volume - the robot moves here after picking.

You must also implement the placing procedure.

4.3 Runtime

Deploy your solution. On the Deployment page, the Action Request Client status should be DISCONNECTED (from the Action Request Server).

Press the Select button and choose the main program (PHO_MAIN_LOC_BASIC).

Start the program in T1 / T2 mode. The USER screen shows the start messages of PHOCLIENT:

PHOCLIENT: Robot Version: V9.40P/61
PHOCLIENT: Photoneo Interface: LS 1.5.0/B1
PHOCLIENT: Photoneo VC IP:   192.168.1.1
PHOCLIENT: Robot Port #1 IP: 192.168.1.2
PHOCLIENT: $HOSTC_CFG[3].$SERVER_PORT OK
PHOCLIENT: Connecting to 192.168.1.1 ...
PHOCLIENT: Connected to VC!

The Action Request Client status on the Deployment page changes to CONNECTED. The robot now sends requests to the vision controller and moves.

After the first poses are received, check them in Data -> Position Reg. We recommend that you move the robot manually to a received pose (Shift + MOVE TO on the PR screen) to check that the frame setup is correct. Then add the gripper commands and the placing routine. Increase the speed slowly in T1 / T2, and then switch to AUTO.

To stop the program, use Fctn -> Abort all. This also aborts PHOCLIENT.

Warning: Be ready to stop the robot at any time. Reduce the speed to 10% of the maximum for the first tests.

5 Version and brand ID

Item

Value

Robot module version

LS 1.5.0

PHOCLIENT version (shown on the USER screen and in the program comment)

LS 1.5.0/B1

Brand ID sent after connecting

_L_FANUC/__F.__1.__5.__0

Server port

11003 (Host Comm client tag C3)

For the supported LS versions, see the Robot module support matrix.

6 Migration

When you update the Robot module, load the new phoclient.pc and all TP programs again.

  • LS 1.4 -> LS 1.5: R[24] - R[29] now hold dimension X, dimension Y, rotation Z, neural network label, max Z height and tilt of the last object. The values of each object are written to the string registers. There is a new example program, PHO_MAIN_LOC_GET_STATUS. See Migration from LS 1.4.x to LS 1.5.x.